// Decompiled by Jad v1.5.8g. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.kpdus.com/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   EditProfileAction.java

package com.boci.clientapp.profile.action;

import com.boci.clientapp.authentication.ChangePasswordDialog;
import com.boci.clientapp.main.ApplicationService;
import com.boci.clientapp.main.ClientAppLoader;
import com.boci.clientapp.profile.EditProfileDialog;
import com.boci.clientapp.profile.ViewProfileDialog;
import com.boci.clientapp.profile.handler.AccountProfileHandler;
import com.boci.clientapp.profile.vo.AccountProfileVO;
import com.boci.common.action.AbstractAction;
import com.boci.common.constant.RequestTypeConst;
import com.boci.common.util.*;
import java.util.HashMap;
import java.util.logging.Logger;

public class EditProfileAction extends AbstractAction
{

    public EditProfileAction()
    {
    }

    private void addExtraValues(HashMap pInpMap)
    {
        pInpMap.put("testValue", "Save Changes");
        pInpMap.put("SaveChanges", "Save Changes");
        pInpMap.put("type", appServ.getViewProfileDialog().getAccountProfileVO().getEmpr_type());
        pInpMap.put("primacctind", "P");
    }

    public void doProcess(HashMap pInpMap, String pActionType)
    {
    	try{
	        appServ.getChangePasswordDialog().setBusy(true);
	        EditProfileDialog editProfileDialog = appServ.getEditProfileDialog();
	        if(pActionType.equals("SAVE"))
	        {
	            addExtraValues(pInpMap);
	            AccountProfileHandler handler = new AccountProfileHandler(RequestTypeConst.BOCI_ACCT_PROF_EDIT_URL);
	            handler.updateAccountProfile(pInpMap);
	            editProfileDialog.showDialog(false);
	            String strNote = ClientAppLoader.getMessagesConfigurator().getUIMessages("PROFILE.CONFIRM_NOTE", appServ.getCurrentLocale());
	            appServ.showInfoDialog(null, strNote);
	        } else
	        if(pActionType.equals("CANCEL"))
	            editProfileDialog.showDialog(false);
    	}
        catch(AppException appEx)
        {
            appServ.showErrorDialog(null, appEx.getMessage());
        }
        catch(Exception sysEx)
        {
            logger.severe(StringUtil.formatException(sysEx));
            appServ.showSysErrDialog();
        }
        finally
        {
            appServ.getChangePasswordDialog().setBusy(false);
        }
        return;
    }
}
